package demo2;

import org.w3c.dom.ls.LSOutput;

class Base {
    public Base() {
        System.out.println("Base");
    }
}

class Derived extends Base {
    public Derived() {
        //super();
        System.out.println("Derived");
    }
}

class Person {
    public String name;
    public int age;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
        System.out.println("构造方法执行");
    }

    {
        System.out.println("实例代码块执行");
    }

    static {
        System.out.println("静态代码块执行");
    }
}

class Student extends Person {
    public Student(String name, int age) {
        super(name, age);
        System.out.println("Student:构造方法执行");
    }
    {
        System.out.println("实例代码块");
    }
    static {
        System.out.println("静态代码块");
    }

}

public class Test {
    public static void main(String[] args) {
        Student student1=new Student("小明", 18);
        System.out.println("==============================");
        Student student2=new Student("山本", 199);

        /*Person person1 = new Person("小明", 18);
        System.out.println("==============================");
        Person person2 = new Person("小明", 18);
        System.out.println("==============================");
        Person person3 = new Person(null, 0);*/
    }

    public static void main1(String[] args) {
        Derived d = new Derived();
    }

}
